<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>

<script>
// It's possible that the bounding box of an editing host is out of viewport,
// but still there is visible content in it. Verify that spelling is checked
// in this case.

const longContent = '<p>line.</p>'.repeat(50) + 'zz|.';
const expectedText = '<p>line.</p>'.repeat(50) + '#zz#.';

spellcheck_test(
  `<div contenteditable style="height: 10px">${longContent}</div>`,
  document => {
    const frameWindow = document.defaultView;
    const frameViewport = frameWindow.visualViewport;
    frameWindow.scrollBy(0, frameViewport.height);
  },
  `<div contenteditable style="height: 10px">${expectedText}</div>`,
  'Spelling is checked even if editing host is out of viewport');
</script>
